<div style="clear: both;"></div>
<div class="b4"></div>
<div id="smartwizard" class="wiz-container">
	<ul id="wizard-anchor">
		<li>
			<a href="#wizard-1">
    			<h2>搜索</h2>
      		</a>
      	</li>
		<li>
			<a href="#wizard-2">
    			<h2>确认</h2>
      		</a>
      	</li>
		<li>
			<a href="#wizard-3">
    			<h2>保存</h2>
      		</a>
      	</li>
	</ul>
	<div id="wizard-body" class="wiz-body">
        <div id="wizard-1" >
            <div class="wiz-content">
            
                <div style="padding: 30px;padding-top:50px;">
                	<form id="frm-topic-search" action="<?php echo site_url('c=topic&m=search');?>"
                		submitbefor="frm_topic_befor"
                		submitafter="frm_topic_after"
                		datatype="html"
                		onsubmit="return false;"
                	>
                	<input id="pagenum" type="hidden" name="pagenum" value="1"/>
                	<table class="tbl-frm-1">
                		<tr>
                			<td class="c3" width="150">歌曲名、专辑名、艺人名：</td>
                			<td>
                				<input id="kws" class="inp" name="kws" />
                			</td>
                		<tr/>
                	</table>
                	</form>

                	<form id="frm-topic-search-first" action="<?php echo site_url('c=topic&m=search');?>"
                		submitafter="frm_topic_after"
                		datatype="html"
                	>
                	<input id="pagenum-first" type="hidden" name="pagenum" value="1"/>
      				<input id="kws-first" type="hidden" name="kws" />
                	</form>
                	
                </div>
            </div>        
            <div class="wiz-nav">
              <input id="btn-music-search" class="btn-s btn-ajax-submit" frmid="frm-topic-search" type="button" value="搜 索" />
              <input id="btn-music-search-first" class="btn-ajax-submit" frmid="frm-topic-search-first" type="hidden" value="adsfa" />
            </div>          
        </div>
        
        <div id="wizard-2" >
            <div class="wiz-content">
                <div id="c-rs"></div>
            </div>        
            <div class="wiz-nav">
              <input class="back btn-s" type="button" value="上一步" />
              <input id="confirm-next" type="hidden" class="next"/> 
              <input id="btn-confirm-next" class="btn-s" type="button" value="下一步" />                        
            </div>          
        </div>
        <style>
        #btn-confirm-next{
			float:right;
        }
        </style>
        <div id="wizard-3" >
            <div class="wiz-content">
            	
                <div style="padding: 20px;padding-top:60px;">
                	<form id="frm-music-post" action="<?php echo site_url('c=topic&m=post_do');?>"
                		onsubmit="return false;"
                	>
					<input type="hidden" id="hdn-post-music-id" name="music_id" value="0"/>
					<input type="hidden" id="hdn-post-music-type" name="music_type" value="1"/>
					<input type="hidden" id="hdn-post-music-name" name="music_name"/>
					
					<input type="hidden" name="recmd" value="<?php echo fd('recmd');?>"/>
					<input type="hidden" name="reason_id" value="<?php echo fd('reason_id','i');?>"/>
					<input type="hidden" name="to_id" value="<?php echo fd('to_id','i');?>"/>
                	
                	<table class="tbl-frm-1">
                		<tr>
                			<td>
                				<input id="cont-topic" class="inp" name="cont" style="width: 450px;"/>
                			</td>
                		<tr/>
                	</table>
                	</form>
                </div>
            </div>        
            <div class="wiz-nav">
              <input class="back btn-s" type="button" value="上一步" />
              <input id="btn-music-post" class="next btn-s btn-ajax-submit" frmid="frm-music-post" type="button" value="保存" />
            </div>          
        </div>
    </div>
</div> 
     
<script type="text/javascript">
$().ready(function() {
    $('.wiz-container').smartWizard();

    $('#btn-confirm-next').click(function(){

        var music_id = $('.rad-music-slt:checked').val();

        if((typeof music_id) == 'undefined'){
        	asyncbox.tips('请选择音乐！','error');
        	return;
        }
        $('#confirm-next').click();        
        var music_type = $('#hdn-music-type').val();
        var music_name = $('.rad-music-slt:checked').attr('music_name');
        $('#hdn-post-music-id').val(music_id);
        $('#hdn-post-music-name').val(music_name);
        $('#hdn-post-music-type').val(music_type);
    });

    $('.asyncbox_close').click(function(){
    	$('#music-media').remove();
    });

	$('#frm-topic-search').keyup(function(e){
		if(e.which == 13){
			$('#btn-music-search').click();
			return false;
		}
	});

	$('#frm-music-post').keyup(function(e){
		if(e.which == 13){
			$('#btn-music-post').click();
			return false;
		}
	});
    
	ajaxinit();
    
}); 
</script>

<script>
function frm_topic_befor($frm){
	var kws = $('#kws').val();
	if(kws.length == 0){
		asyncbox.tips('请输入关键字！','error');
		$('#kws').focus();
		return false;
	}
	$('#kws-first').val(kws);
	
	return true;
}


function frm_topic_after(msg,$frm){
	$('#c-rs').html('').html(msg);
	$('#smartwizard').smartWizard({selectedStep: 1}); 
	return false;
}

</script>

